#ifndef _APP_UART_H_
#define _APP_UART_H_
#include "project.h"
#include "UART_Debug.h"
#include "UART_Debug_SCB_IRQ.h"
#include "UART_Debug_SPI_UART.h"
    
 
#define MAX_RX_BUFFER_LENGTH 9
    
 typedef struct{
	uint8_t fixed_id;
	uint8_t state_id;
	uint8_t touch_st;
	uint8_t live_si;
    uint8_t rst_num;
	uint8_t contact;
	uint8_t crc8;
}Heartbeat; 

typedef struct{
    uint8_t target;
	uint8_t fixed_id;
	uint8_t state_id;
	uint8_t xlsb;
	uint8_t xmsb;
	uint8_t ylsb;
	uint8_t ymsb;
	uint8_t crc8;
}PTouch;




extern uint8_t   RST_Count;
extern uint8_t   Live_Count;
extern uint8_t   Touch_State;

extern PTouch protocol_touch;    //touch send structural 
extern Heartbeat protocol_live;   // live singal
    
    
    
extern uint8_t bufs[5];    
extern struct ring_buffer_t  ring_buffer;   
    
    
    
    
    
    
    
    
    
    
    
    

    void App_Uart_init(void);  
    void App_UART_Send(uint8_t *databuff,uint8_t length);
    void APP_receive_message_progress(void);
    void App_message_analyse();
    uint8_t App_CRC8_Check(uint8_t *ptr, uint8_t len);


 
 void App_protocol_send_live_singal(void);
 void App_send_touch_data(uint8_t finger_id_t,uint8_t flag_id,uint8_t xlsb,uint8_t xmsb,uint8_t ylsb,uint8_t ymsb );
#endif
    

